const express = require("express");
const { getMessageServices, addMessageServices, deleteMessageServices } = require("../services/messageServices");
const router = express.Router();

//提交评论或留言
router.post("/", async (req, res, next) => {
    console.log("message", req.body);
    res.send(await addMessageServices(req.body));
});

// 删除评论或留言
router.delete("/:id", async (req, res, next) => {
    res.send(await deleteMessageServices(req.params.id));
});

// 分页获取评论或留言
router.get("/", async (req, res, next) => {
    res.send(await getMessageServices(req.query));
});

module.exports = router;